package com.arofoxmsn.model.friendship;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;

import com.arofoxmsn.model.User;

@Entity
public class Friendship {
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "id", unique = true, nullable = false)
	private long id;
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private User master;
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private User slave;
	
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private FriendshipConfiguration configuration;
	
	@Column(name="user_state") 
	@Enumerated(EnumType.ORDINAL) 
	private FriendshipStateType state;

	
	public long getId() {return id;}
	public void setId(long id) {this.id = id;}

	public User getMaster() {return master;}
	public void setMaster(User master) {this.master = master;}
	
	public User getSlave() {return slave;}
	public void setSlave(User slave) {this.slave = slave;}

	public FriendshipConfiguration getConfiguration() {return configuration;}
	public void setConfiguration(FriendshipConfiguration configuration) {this.configuration = configuration;}
	
	public FriendshipStateType getState() {return state;}
	public void setState(FriendshipStateType state) {this.state = state;}
	
}
